**********************************************
******	Table A15: Effects of Cash across Priming Conditions   
**********************************************

use "$dir/data/analysis_main.dta", clear


foreach x of varlist cash_postpay cash_announce{
	gen `x'_fincashpoor = `x'*fincashpoor
	gen `x'_fincashrich = `x'*fincashrich
}


	eststo clear
	
	* Double post lasso
	*** Preferred spec is the one below:
	eststo: reghdfe n_productivity cash_postpay cash_postpay_fincashpoor cash_postpay_fincashrich cash_announce blhrprod blhrprodsq blhrprod_miss bs_labor_30_miss future_fin_worry_miss i.pd if pd>0, vce(cl pid) absorb(roundgroup)
	qui estadd local cont1 "Y"
	qui estadd local cont2 "Y"
	qui estadd local cont3 "Y"	
	qui estadd local fe1 "Y"
	qui estadd local fe2 "N"	
	lincom cash_postpay + cash_postpay_fincashpoor
	qui estadd scalar coef1 = r(estimate)
	qui estadd scalar se1 = r(se)			
	qui estadd scalar pval1 = 2*ttail(r(df),abs(r(estimate)/r(se)))	
	lincom cash_postpay + cash_postpay_fincashrich
	qui estadd scalar coef2 = r(estimate)
	qui estadd scalar se2 = r(se)			
	qui estadd scalar pval2 = 2*ttail(r(df),abs(r(estimate)/r(se)))		
	
	* Heterogeneity binary
	cap drop *_hiw
	foreach x of varlist cash_postpay cash_postpay_fincashpoor cash_postpay_fincashrich cash_announce cash_announce_fincashpoor cash_announce_fincashrich{
		gen `x'_hiw = `x'*wealth_hi_avg
	}		

	eststo: reghdfe n_productivity cash_postpay cash_postpay_fincashpoor cash_postpay_fincashrich cash_announce cash_postpay_hiw cash_postpay_fincashpoor_hiw cash_postpay_fincashrich_hiw cash_announce_hiw wealth_hi_avg blhrprod blhrprodsq blhrprod_miss bs_labor_30_miss future_fin_worry_miss i.pd if pd>0, vce(cl pid) absorb(roundgroup)
	qui estadd local cont1 "Y"
	qui estadd local cont2 "Y"
	qui estadd local cont3 "Y"	
	qui estadd local fe1 "Y"
	qui estadd local fe2 "N"
	qui estadd local index "Binary"
	lincom cash_postpay + cash_postpay_fincashpoor
	qui estadd scalar coef1 = r(estimate)
	qui estadd scalar se1 = r(se)			
	qui estadd scalar pval1 = 2*ttail(r(df),abs(r(estimate)/r(se)))	
	lincom cash_postpay + cash_postpay_fincashrich
	qui estadd scalar coef2 = r(estimate)
	qui estadd scalar se2 = r(se)			
	qui estadd scalar pval2 = 2*ttail(r(df),abs(r(estimate)/r(se)))		
	qui lincom cash_postpay + cash_postpay_hiw
	qui estadd scalar coef3 = r(estimate)
	qui estadd scalar se3 = r(se)			
	qui estadd scalar pval3 = 2*ttail(r(df),abs(r(estimate)/r(se)))	
	qui lincom cash_postpay + cash_postpay_hiw + cash_postpay_fincashpoor + cash_postpay_fincashpoor_hiw
	qui estadd scalar coef4 = r(estimate)
	qui estadd scalar se4 = r(se)			
	qui estadd scalar pval4 = 2*ttail(r(df),abs(r(estimate)/r(se)))	
	qui lincom cash_postpay + cash_postpay_hiw + cash_postpay_fincashrich + cash_postpay_fincashrich_hiw
	qui estadd scalar coef5 = r(estimate)
	qui estadd scalar se5 = r(se)			
	qui estadd scalar pval5 = 2*ttail(r(df),abs(r(estimate)/r(se)))		
	
label var cash_postpay_fincashpoor "Cash $\times$ Post-pay $\times$ Cash-poor priming"
label var cash_postpay_fincashrich "Cash $\times$ Post-pay $\times$ Cash-rich priming"
label var cash_postpay_hiw "Cash $\times$ Post-pay $\times$ Higher wealth" 
label var cash_announce_hiw "Cash $\times$ Announcement $\times$ Higher wealth" 	
label var cash_postpay_fincashpoor_hiw "Cash $\times$ Post-pay $\times$ Cash-poor priming $\times$ Higher wealth" 
label var cash_postpay_fincashrich_hiw "Cash $\times$ Post-pay $\times$ Cash-rich priming $\times$ Higher wealth" 

#delimit ;
local tablerow cash_postpay cash_postpay_fincashpoor cash_postpay_fincashrich cash_announce cash_postpay_hiw cash_postpay_fincashpoor_hiw cash_postpay_fincashrich_hiw cash_announce_hiw;

esttab using "$oa/$t/Table_A15.tex", 
    b(3) se booktabs star(* .1 ** .05 *** .01) collabels(,none) nonotes nomtitles 
    replace label style(tex) gaps keep(`tablerow') order(`tablerow') 
    stats(cont1 cont2 cont3 fe1 coef1 se1 pval1 coef2 se2 pval2 N, labels("Linear baseline output" "Quadratic baseline output" "Post-double selection lasso controls" "Round-wave FE" "Coef: (Cash $\times$ Post-pay) + (Cash $\times$ Post-pay $\times$ Cash-poor priming)" "SE: (Cash $\times$ Post-pay) + (Cash $\times$ Post-pay $\times$ Cash-poor priming)" "P-val: (Cash $\times$ Post-pay) + (Cash $\times$ Post-pay $\times$ Cash-poor priming)" "Coef: (Cash $\times$ Post-pay) + (Cash $\times$ Post-pay $\times$ Cash-rich priming)" "SE: (Cash $\times$ Post-pay) + (Cash $\times$ Post-pay $\times$ Cash-rich priming)" "P-val: (Cash $\times$ Post-pay) + (Cash $\times$ Post-pay $\times$ Cash-rich priming)" "N: worker-hours") fmt(%50s %50s %50s %50s %9.3fc %9.3fc %9.3fc %9.3fc %9.3fc %9.3fc %9.0fc))    
	prehead("{\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} 
	\begin{tabular}     
	{@{\extracolsep{4pt}}l*{15}{>{\centering\arraybackslash}m{2.5cm}}@{}}      \toprule    
	&\multicolumn{2}{c}{\textbf{Hourly Production}}     \bigstrut       \\ 
	\cline{2-3} \addlinespace 	
	") ;
		
#delimit cr	
